Powered knee and ankle prosthesis